"use strict";
const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: "./",
  outputDir: "student",
  assetsDir: "static",
  lintOnSave: true,
  productionSourceMap: false,
  devServer: {
    open: true,
    host: "localhost",
    port: 8001,
    https: false,
    hotOnly: false,
    proxy: {
      '/auto': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/student_manage': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/problem_property': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/practice': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/error': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/exam': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/score': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/answer': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },
      '/analysis': {
        target: "http://47.113.144.194:8000",
        changeOrigin: true,
        headers: {
          Cookie: "",
          Token: "",
        },
      },

    },
  },
  pages: {
    index: {
      entry: "src/main.js",
      template: "public/index.html",
      filename: "index.html",
    },
  },
  chainWebpack(config) {
    // set svg-sprite-loader
    config.module.rule("svg").exclude.add(resolve("src/icons")).end();
    config.module
      .rule("icons")
      .test(/\.svg$/)
      .include.add(resolve("src/icons"))
      .end()
      .use("svg-sprite-loader")
      .loader("svg-sprite-loader")
      .options({
        symbolId: "icon-[name]",
      })
      .end();
  },
};
